<?php
/**
 * ITS Retrieve
 */
class IR extends AppModel {
    var $name = 'IR';

    var $useTable = 'its_retrieves';

    const ITS_STOCK_IN_TYPE = 'IR';

    var $belongsTo = array('Product', 'CustProductSite',
        'IRH' => array(
            'foreignKey' => 'its_retrieve_head_id'
        ),
    );

    var $hasMany = array(
        'ProductSerial' => array(
            'foreignKey' => 'its_stock_in_id',
            'conditions' => array(
                'its_stock_in_type' => self::ITS_STOCK_IN_TYPE
            )
        )
    );

    var $validate = array(
        'retrieve_qty' => array(
                'rule' => 'numeric',
                'message' => 'Please input retrieve qty.',
                'on' => 'create'
        ),
    );
}
?>
